function findUniq(arr) {
    let i = 0
    let same = arr[0] == arr[1]?arr[0]:arr[1]==arr[2]?arr[1]:arr[0]
    if(arr.length>3){
        while(arr[i]==same){
            i++
        }
        return arr[i]
    }
    else{
        return arr[0] == arr[1]?arr[2]:(arr[1]==arr[2]?arr[0]:arr[1])
    }
}
function _findUniq(arr) {
    let same = arr[0] == arr[1]?arr[0]:arr[1]==arr[2]?arr[1]:arr[0]
    let newArr = Array.from(new Set(arr)).find(x=>x!=same)
    return newArr[1-newArr.indexOf(same)]
}
console.log(_findUniq([ 1, 1, 1, 2, 1, 1 ]))